package com.agileboot.api.controller;

import com.agileboot.common.core.base.BaseController;
import com.agileboot.common.core.dto.ResponseDTO;
import com.agileboot.domain.system.user.UserApplicationService;
import com.agileboot.domain.system.user.command.UpdateAppUserCommand;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class AppUserController extends BaseController {

    private final UserApplicationService userApplicationService;

    @PutMapping("/edit")
    public ResponseDTO<Void> edit(@Validated @RequestBody UpdateAppUserCommand command) throws IOException {
        userApplicationService.UpdateAppUser(command);
        return ResponseDTO.ok();
    }
}
